# Contributor: Bart Ribbers <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-frameworks
maintainer="team/kde <bribbers@disroot.org>"
pkgname=kcoreaddons
pkgver=6.7.0
pkgrel=0
pkgdesc="Addons to QtCore"
arch="all"
url="https://community.kde.org/Frameworks"
license="LGPL-2.0-or-later AND (LGPL-2.1-only OR LGPL-3.0-only)"
depends_dev="qt6-qtbase-dev"
makedepends="$depends_dev
	breeze-icons
	doxygen
	extra-cmake-modules
	graphviz
	qt6-qttools-dev
	samurai
	shared-mime-info
	"
checkdepends="xvfb-run"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang kde-default-icon-theme:icons:noarch"
_repo_url="https://invent.kde.org/frameworks/kcoreaddons.git"
source="https://download.kde.org/stable/frameworks/${pkgver%.*}/kcoreaddons-$pkgver.tar.xz"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_QCH=ON
	cmake --build build
}

check() {
	# klistopenfilesjobtest_unix requires >8000 open files
	local disabled_tests="klistopenfilesjobtest_unix|kdirwatch_qfswatch_unittest|kdirwatch_stat_unittest|knetworkmountstestpaths"
	case "$CARCH" in
		s390x) disabled_tests="$disabled_tests|kdirwatch_inotify_unittest" ;;
		x86_64) disabled_tests="$disabled_tests|kfileutilstest" ;; # Only fails on builders
	esac

	xvfb-run -a ctest --test-dir build --output-on-failure -E "($disabled_tests)"
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

icons() {
	pkgdesc="Virtual to automatically pull in breeze icons by default for KDE apps"
	install_if="$pkgname=$pkgver-r$pkgrel"
	depends="breeze-icons"

	mkdir -p "$subpkgdir"
}

sha512sums="
cfe09e2caf103edba07950ca1b4433f96b790926b4fe64e82537c685a41e427205ea1b24cde58f7ade762251b7a56e3a18c9ea61bfe8c978e17129ebea3464f1  kcoreaddons-6.7.0.tar.xz
"
